package com.yugao.fintech.libra.workflow.service.impl;

import com.yugao.fintech.libra.workflow.domain.FlowDefRelation;
import com.yugao.fintech.libra.workflow.domain.FlowTaskRelation;
import com.yugao.fintech.libra.workflow.domain.dto.FlowProcDefDto;
import com.yugao.fintech.libra.workflow.mapper.IFlowRelationMapper;
import com.yugao.fintech.libra.workflow.service.IFlowRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class FlowRelationServiceImpl implements IFlowRelationService {

    @Autowired
    private IFlowRelationMapper flowRelationMapper;

    @Override
    public List<FlowProcDefDto> defList(String name, String category) {
        return flowRelationMapper.defList(name, category);
    }

    @Override
    public FlowProcDefDto queryDefByProcDefId(String procDefId) {
        return flowRelationMapper.queryDefByProcDefId(procDefId);
    }

    @Transactional
    @Override
    public int addDef(FlowDefRelation flowDefRelation) {
        return flowRelationMapper.addDef(flowDefRelation);
    }

    @Override
    public FlowDefRelation queryDefByCategory(String category) {
        return flowRelationMapper.queryDefByCategory(category);
    }

    @Transactional
    @Override
    public int removeDefByDeployId(String deployId) {
        return flowRelationMapper.removeDefByDeployId(deployId);
    }

    @Transactional
    @Override
    public int editDefStatusByDeployId(String deployId, Integer status) {
        return flowRelationMapper.editDefStatusByDeployId(deployId, status);
    }

    @Transactional
    @Override
    public int addTask(FlowTaskRelation flowTaskRelation) {
        return flowRelationMapper.addTask(flowTaskRelation);
    }

    @Override
    public FlowTaskRelation queryTaskByProcInsId(String procInsId) {
        return flowRelationMapper.queryTaskByProcInsId(procInsId);
    }
}
